package
{
	import flash.display.Sprite;
	import flash.geom.Point;

	public class VTUtil
	{
		public function VTUtil()
		{
		}
	
		public static function getRoundedRect(width:int, height:int, color:uint=0xffffff, alpha:Number = 1, ellipseWidth:Number = 5, ellipseHeight:Number = 5):Sprite{
			var image:Sprite = new Sprite();
			image.graphics.beginFill(color,alpha);
			image.graphics.drawRoundRect(0,0,width,height,ellipseWidth, ellipseHeight);
			image.graphics.endFill();
			return image;
		}		
		
		public static function getRectOutline(width:int, height:int, color:uint=0x0000ff, thickness:Number = 1, alpha:Number = 1):Sprite{
			var image:Sprite = new Sprite();
			image.graphics.lineStyle(thickness, color, alpha);
			image.graphics.lineTo(width, 0);
			image.graphics.lineTo(width, height);
			image.graphics.lineTo(0, height);
			image.graphics.lineTo(0,0);
			return image;
		}
		
		public static function getGrid(width:int, height:int, gridWidth:int, gridHeight:int, color:uint=0xffffff, thickness:Number = 1):Sprite{
			var ratio:Point = new Point(width / gridWidth, height / gridHeight);

			var image:Sprite = new Sprite();
			image.graphics.lineStyle(thickness, color);
			for(var i:int=0;i<=gridWidth;i++){
				image.graphics.moveTo(i*ratio.x, 0);
				image.graphics.lineTo(i*ratio.x, height);
			}
			for(var j:int=0;j<=gridHeight;j++){
				image.graphics.moveTo(0, j*ratio.y);
				image.graphics.lineTo(width, j*ratio.y);
			}			
			
			return image;
		}
		
	}
}